from PIL import Image
from PIL.ExifTags import TAGS

def print_exif_info(image_path):
    try:
        image = Image.open(image_path)
        exif_data = image._getexif()
        if exif_data is not None:
            for tag_id, value in exif_data.items():
                tag_name = TAGS.get(tag_id, tag_id)
                print(f'{tag_name}: {value}')
        else:
            print('该图片没有 EXIF 信息')
    except Exception as e:
        print(f'无法打开图片 {image_path}: {str(e)}')

if __name__ == "__main__":
    # 指定图片路径
    image_path = './bb_love.png'
    print_exif_info(image_path)